<div class="bjui-pageContent">
<form action="/admin/pro/add" id="product-add-form" data-toggle="validate" data-alertmsg="false">
    <div class="bjui-row">
        <div class="bjui-row col-2">
            <label class="row-label">产品名称</label>
            <div class="row-input required">
                <input type="text" name="product_name" id="product_name" data-rule="required">
            </div>
        </div>
        <div class="bjui-row col-2">
            <label class="row-label">产品编号</label>
            <div class="row-input">
                <input type="text" name="product_no" id="product_no">选填，为空时编号自动生成
            </div>
        </div>
        @if($categoryInfo)
            <div class="bjui-row col-2">
                <label class="row-label">分类</label>
                <div class="row-input">
                    <input type="hidden" name="category_id" value="{{$categoryInfo['id']}}">
                    {{$categoryInfo['cat_name']}}
                </div>
            </div>
        @else
            <div class="bjui-row col-2">
                <label class="row-label">分类</label>
                <div class="row-input required">
                    <select name="category_id" id="category_id" data-toggle="selectpicker" data-rule="required">
                        <option value="">全部</option>
                        @foreach ($catelist as $key => $value)
                            <option value="{{ $key }}" >{{ $value }}</option>
                        @endforeach
                    </select>
                </div>
            </div>
        @endif
        <div class="bjui-row col-2">
            <label class="row-label">产品图片</label>
            <div class="row-input">
                <input type="file" data-name="img_id" data-id="img_id" data-toggle="webuploader" data-options="
                {
                    pick: {label: '点击选择图片'},
                    upname:'img_id',
                    server: 'admin/photo/upload',
                    fileNumLimit: 1,
                    formData: {_token : '{{ csrf_token() }}'},
                    required: true,
                    uploaded: '',
                    basePath: '',
                    accept: {
                        title: '图片',
                        extensions: 'jpg,png',
                        mimeTypes: '.jpg,.png'
                    }
                }">
            </div>
        </div>
        <div class="bjui-row col-2">
            <label class="row-label">单价</label>
            <div class="row-input">
                <input type="text" name="price" id="price" size="">
            </div>
        </div>
        <div class="bjui-row col-2">
            <label class="row-label">数量</label>
            <div class="row-input">
                <input type="text" name="number" id="number" size="" readonly disabled>
            </div>
        </div>
        @foreach ($categoryFields as $val)
        <div class="bjui-row col-2">
            <label class="row-label">{{$val['field_name']}}</label>
            <input type="hidden" name="customer_field_name[]" value="{{$val['field_name']}}">
            <input type="hidden" name="customer_field_type[]" value="{{$val['field_type']}}">
            <div class="row-input">
                <input type="text" name="customer_field_value[]" size="" placeholder="{{$val['placeholder']}}">
            </div>
        </div>
        @endforeach

        <div class="bjui-row col-2">
            <label class="row-label">预警数量</label>
            <div class="row-input">
                <input type="text" name="warning_number" id="warning_number" data-rule="required">
            </div>
        </div>
        <div class="bjui-row col-2">
            <label class="row-label">充足数量</label>
            <div class="row-input">
                <input type="text" name="full_number" id="full_number" data-rule="required">
            </div>
        </div>
        <div class="bjui-row col-2">
            <label class="row-label">公共材料</label>
            <div class="row-input">
                <select name="is_public" id="is_public" data-toggle="selectpicker" data-rule="required">
                        <option value="yes">是</option>
                        <option value="no">否</option>
                </select>
            </div>
        </div>
        <div class="bjui-row col-2">
            <label class="row-label">单位</label>
            <div class="row-input required">
                <select name="unit" id="unit" data-toggle="selectpicker" data-rule="required">
                    @foreach ($units as $line)
                        <option value="{{ $line['value'] }}">{{ $line['value'] }}</option>
                    @endforeach
                </select>
            </div>
        </div>
        <div class="bjui-row col-2">
            <label class="row-label"></label>
            <div class="row-input">
                <button type="submit" class="btn-default" data-icon="save">保存</button>
                <button type="button" class="btn-close" data-icon="close">取消</button>
            </div>
        </div>
    </div>
</form>
</div>